<template>
	<div class="swiper banner"  @click="$enter('/News/Index')">
		<!-- <div class="swiper-wrapper">
			<div class="swiper-slide">
				<div class="text">恭喜某某宝贝获取成长1号宝箱获取2000积分</div>
				<img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
			</div>
			<div class="swiper-slide">
				<div class="text">恭喜某某宝贝获取成长1号宝箱获取2000积分</div>
				<img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
			</div>
			<div class="swiper-slide">
				<div class="text">恭喜某某宝贝获取成长1号宝箱获取2000积分</div>
				<img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
			</div>
		</div> -->

		<swiper class="swiper swiper-wrapper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
				:duration="duration">
			<swiper-item v-for="item in newsList">
				<view class="swiper-item uni-bg-red swiper-slide">
					<div class="text">{{ item.title }}</div>
					<img :src="item.main_pic">
				</view>
			</swiper-item>
			<!-- <swiper-item>
				<view class="swiper-item uni-bg-green swiper-slide">
					<div class="text">恭喜某某宝贝获取成长1号宝箱获取2000积分</div>
					<img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
				</view>
			</swiper-item>
			<swiper-item>
				<view class="swiper-item uni-bg-blue swiper-slide">
					<div class="text">恭喜某某宝贝获取成长1号宝箱获取2000积分</div>
					<img src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
				</view>
			</swiper-item> -->
		</swiper>

		<div class="swiper-pagination"></div>
	</div>
</template>
<script>
	export default {
		data() {
        return {
            background: ['color1', 'color2', 'color3'],
            indicatorDots: true,
            autoplay: true,
            interval: 2000,
            duration: 500,
						newsList: [],
						static_uri: getApp().globalData.glb_list.config.static_uri, // 获取全局配置文件
						glbId: getApp().globalData.glb_list.glbId, // 获取全局的id
        }
    },
		mounted() {
			this._getNew(getApp().globalData.glb_list.newList)
			// var swiper = new Swiper(".banner", {
			// 	loop:true,
			// 	autoplay: {
			// 		delay: 3000, //3秒切换一次
			// 	},
			// 	pagination: {
			// 		el: ".swiper-pagination",
			// 	},
			// });
		},
		methods: {
			_getNew(list) {
				this.newsList = list.map(i => ({...i, main_pic: `${this.static_uri}${i.main_pic}`})).filter(i => i.sid === this.glbId);
			}
		}
	}
</script>
<style scoped lang="scss">
.uni-margin-wrap {
		/* width: 690rpx;
		width: 100%; */
	}
	.swiper {
		/* height: 814rpx; */
		height: 7.19rem;
	}
	.swiper-item {
		display: block;
		/* height: 300rpx;
		line-height: 300rpx; */
		text-align: center;
	}
	.swiper-list {
		margin-top: 40rpx;
		margin-bottom: 0;
	}
	.uni-common-mt {
		margin-top: 60rpx;
		position: relative;
	}
	.info {
		position: absolute;
		right: 20rpx;
	}
	.uni-padding-wrap {
		width: 550rpx;
		padding: 0 100rpx;
	}
	.banner {
		width: 7.19rem;
		height: 5.09rem;
		border-radius: 8px;
		overflow: hidden;
		background-color: #fff;
		position: relative;
	}
	.banner img{width: 100%; height: 100%;}
	.swiper-slide{position: relative;}
	.swiper-slide .text{position: absolute; text-align: center; left: 10%; top: 5%; right: 10%; background: rgba(255,249,240,0.68); line-height: .52rem; padding: 0px .2rem; border-radius: .26rem; font-size: .24rem; color: #FD4933;}
</style>